# -*- coding: utf-8 -*-#

#-------------------------------------------------------------------------------
# Name:         ljy
# Description:  
# Author:       lenovo
# Date:         2018/11/22
#-------------------------------------------------------------------------------

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import bs4

from time import sleep
from entity.IndexUrl import IndexUrl

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
browser = webdriver.Chrome(chrome_options=chrome_options)
indexUrl = IndexUrl()
browser.get(indexUrl.urls[0])
browser.find_element_by_id("dataMoreBtn").click()
sleep(0.5)
browser.find_element_by_id("dataMoreBtn").click()
sleep(0.5)
page = browser.page_source
browser.close()

print(page)

soup = bs4.BeautifulSoup(page, 'html5lib')
count = 0
elems = soup.select('#showData0 .clearfix h3 a')
for e in elems:
    count += 1
    print(e['href'])
print(count)
